@extends('admin.main')

@section('content')
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-title">
            <h5>能量补充列表</h5>
        </div>
        <div class="ibox-content">

            <div class="tabs-container">
                <div class="tab-content">
                    <div class="tab-pane active">
                         <div class="panel-body">
 <!--                            <form role="form" class="form-inline">
                                <div class="form-group">
                                    <input type="text" name="title" placeholder="标题" class="form-control">
                                </div>
                                <button class="btn btn-primary btn-sm" type="button" id="buttonData">搜索</button>
                            </form> -->
                            <!-- <div class="hr-line-dashed"></div> -->
                            <table class="table table-striped table-bordered">
                                  <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>会员昵称</th>
                                        <th>会员编号</th>
                                        <th>能量说明</th>
                                        <th>支付费用</th>
                                    </tr>
                                </thead>
                                <tbody id="tblDataList">

                                </tbody>
                            </table>
                            <div class="text-center " id='pagination'></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="tplDataListTr">
    @{{each rows.data as row i}}
        <tr>
            <td>@{{i+1}}</td>
            <td>@{{row.user.nickname}}</td>
            <td>@{{row.user.number}}</td>
            <td>@{{row.title}}</td>
            <td>@{{row.price}}</td>
        </tr>
    @{{/each}}
</script>

@endsection

@section('pageheader')
@endsection
@section('pagescript')

<script>
    $("#side-menu li[rel='Energy']").addClass("active")
    var filter = {page:1,status:0};
    $(function () {
        renderList();

        $("#pagination").on("click", ".pagination a", function() {
            filter.page = $(this).attr("rel");
            renderList();
        });

    })

    var renderList = function(){
        $("#tblDataList tbody").html('<tr><td colspan="5">'+load+'</td></tr>');
        var url = '/admin/energy/page-rows';
        $.get(url,filter,function(data){
            var pagination = data.rows;;
            $("#tblDataList").html(template("tplDataListTr", data));
            $("#pagination").html(page(pagination.last_page, pagination.total, pagination.current_page));
        }).fail(failure);
    };

</script>
@endsection
